<!--
 * @Author: 陈俊升 761723995@qq.com
 * @Date: 2024-01-31 16:40:20
 * @LastEditors: 陈俊升 761723995@qq.com
 * @LastEditTime: 2024-02-03 11:06:42
 * @FilePath: /hr_new_vue3/src/views/Management/Human/BaseSetting/IntershipSetting/IntershipEvaluation/Components/Preview/index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%B
-->
<!-- 预览模板 -->
<template>
  <a-modal
    :visible="visible"
    @ok="handleOk"
    @cancel="handleCancel"
    width="80%"
    :mask-closable="false"
    title-align="center"
    unmountOnClose
    :body-style="{
      height: '500px'
    }"
  >
    <template #title> {{ data?.baseInfo.name }} </template>
    <div class="wrap">
      <a-form :model="formData.data" disabled>
        <section v-if="formData.data?.wenJian?.length > 0">
          <div class="title-box">
            <div class="title">
              <div
                :style="{
                  marginLeft: '20px'
                }"
              >
                文件移交
              </div>
            </div>
          </div>
          <a-form-item hide-label no-style>
            <a-table
              :data="formData.data.wenJian"
              :pagination="false"
              :bordered="{ cell: true }"
            >
              <template #columns>
                <a-table-column title="文件名称" :width="200" dataIndex="name">
                  <template #title>
                    <span class="star">文件名称</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input
                        v-model="record.name"
                        :style="{ borderStyle: 'none' }"
                      />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="文件交接说明"
                  :width="200"
                  dataIndex="remark"
                >
                  <template #title>
                    <span class="star">文件交接说明</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.remark" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column title="数量" :width="200" dataIndex="num">
                  <template #title>
                    <span class="star">数量</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input-number
                        hide-button
                        :min="1"
                        v-model="record.num"
                      />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="接收人"
                  :width="200"
                  dataIndex="acceptId"
                >
                  <template #title>
                    <span class="star">接收人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.acceptId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="监督人"
                  :width="200"
                  dataIndex="superviseId"
                >
                  <template #title>
                    <span class="star">监督人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.superviseId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
              </template>
            </a-table>
          </a-form-item>
        </section>

        <section v-if="formData.data?.riChang?.length > 0">
          <div class="title-box">
            <div class="title">
              <div
                :style="{
                  marginLeft: '20px'
                }"
              >
                日常工作移交
              </div>
            </div>
          </div>
          <a-form-item hide-label no-style>
            <a-table
              :data="formData.data.riChang"
              :pagination="false"
              :bordered="{ cell: true }"
            >
              <template #columns>
                <a-table-column title="工作事项" :width="200" dataIndex="name">
                  <template #title>
                    <span class="star">工作事项</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.name" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="工作事项情况说明"
                  :width="200"
                  dataIndex="remark"
                >
                  <template #title>
                    <span class="star">工作事项情况说明</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.remark" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="接收人"
                  :width="200"
                  dataIndex="acceptId"
                >
                  <template #title>
                    <span class="star">接收人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.acceptId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="监督人"
                  :width="200"
                  dataIndex="superviseId"
                >
                  <template #title>
                    <span class="star">监督人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.superviseId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
              </template>
            </a-table>
          </a-form-item>
        </section>

        <section v-if="formData.data?.unFinished?.length > 0">
          <div class="title-box">
            <div class="title">
              <div
                :style="{
                  marginLeft: '20px'
                }"
              >
                未完成事项
              </div>
            </div>
          </div>
          <a-form-item hide-label no-style>
            <a-table
              :data="formData.data.unFinished"
              :bordered="{ cell: true }"
              :pagination="false"
            >
              <template #columns>
                <a-table-column title="事项" :width="200" dataIndex="name">
                  <template #title>
                    <span class="star">事项</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.name" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="完成情况"
                  :width="200"
                  dataIndex="situation"
                >
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.situation" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="事项情况说明"
                  :width="200"
                  dataIndex="remark"
                >
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.remark" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="完成时间"
                  :width="200"
                  dataIndex="endTime"
                >
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-date-picker v-model="record.endTime" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="接收人"
                  :width="200"
                  dataIndex="acceptId"
                >
                  <template #title>
                    <span class="star">接收人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.acceptId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="监督人"
                  :width="200"
                  dataIndex="superviseId"
                >
                  <template #title>
                    <span class="star">监督人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.superviseId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
              </template>
            </a-table>
          </a-form-item>
        </section>

        <section v-if="formData.data?.daiBan?.length > 0">
          <div class="title-box">
            <div class="title">
              <div
                :style="{
                  marginLeft: '20px'
                }"
              >
                待办事项
              </div>
            </div>
          </div>
          <a-form-item hide-label no-style>
            <a-table
              :data="formData.data.daiBan"
              :bordered="{ cell: true }"
              :pagination="false"
            >
              <template #columns>
                <a-table-column title="事项" :width="200" dataIndex="name">
                  <template #title>
                    <span class="star">事项</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.name" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="完成情况"
                  :width="200"
                  dataIndex="situation"
                >
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.situation" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="事项情况说明"
                  :width="200"
                  dataIndex="remark"
                >
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.remark" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="完成时间"
                  :width="200"
                  dataIndex="endTime"
                >
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-date-picker v-model="record.endTime" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="接收人"
                  :width="200"
                  dataIndex="acceptId"
                >
                  <template #title>
                    <span class="star">接收人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.acceptId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="监督人"
                  :width="200"
                  dataIndex="superviseId"
                >
                  <template #title>
                    <span class="star">监督人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.superviseId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
              </template>
            </a-table>
          </a-form-item>
        </section>

        <section v-if="formData.data?.ziChan?.length > 0">
          <div class="title-box">
            <div class="title">
              <div
                :style="{
                  marginLeft: '20px'
                }"
              >
                资产移交
              </div>
            </div>
          </div>
          <a-form-item hide-label no-style>
            <a-table
              :data="formData.data.ziChan"
              :bordered="{ cell: true }"
              :pagination="false"
            >
              <template #columns>
                <a-table-column title="资产名称" :width="200" dataIndex="name">
                  <template #title>
                    <span class="star">资产名称</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.name" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column title="数量" :width="200" dataIndex="num">
                  <template #title>
                    <span class="star">数量</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input-number
                        hide-button
                        :min="1"
                        v-model="record.num"
                      />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column title="用途" :width="200" dataIndex="remark">
                  <template #title>
                    <span class="star">用途</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.remark" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="接收人"
                  :width="200"
                  dataIndex="acceptId"
                >
                  <template #title>
                    <span class="star">接收人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.acceptId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="监督人"
                  :width="200"
                  dataIndex="superviseId"
                >
                  <template #title>
                    <span class="star">监督人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.superviseId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
              </template>
            </a-table>
          </a-form-item>
        </section>

        <section v-if="formData.data?.ziYuan?.length > 0">
          <div class="title-box">
            <div class="title">
              <div
                :style="{
                  marginLeft: '20px'
                }"
              >
                资源移交
              </div>
            </div>
          </div>
          <a-form-item hide-label no-style>
            <a-table
              :data="formData.data.ziYuan"
              :bordered="{ cell: true }"
              :pagination="false"
            >
              <template #columns>
                <a-table-column title="资源名称" :width="200" dataIndex="name">
                  <template #title>
                    <span class="star">资源名称</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.name" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column title="资源上传" :width="200" dataIndex="url">
                  <template #title>
                    <span class="star">资源上传</span>
                  </template>
                  <template #cell="{}">
                    <a-form-item hide-label>
                      <a-upload ref="uploadRef" action="/" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="接收人"
                  :width="200"
                  dataIndex="acceptId"
                >
                  <template #title>
                    <span class="star">接收人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.acceptId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="监督人"
                  :width="200"
                  dataIndex="superviseId"
                >
                  <template #title>
                    <span class="star">监督人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.superviseId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
              </template>
            </a-table>
          </a-form-item>
        </section>

        <section v-if="formData.data?.other?.length > 0">
          <div class="title-box">
            <div class="title">
              <div
                :style="{
                  marginLeft: '20px'
                }"
              >
                其他交接事项
              </div>
            </div>
          </div>
          <a-form-item hide-label no-style>
            <a-table
              :data="formData.data.other"
              :bordered="{ cell: true }"
              :pagination="false"
            >
              <template #columns>
                <a-table-column title="事项名称" :width="200" dataIndex="name">
                  <template #title>
                    <span class="star">事项名称</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.name" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="事项说明"
                  :width="200"
                  dataIndex="remark"
                >
                  <template #title>
                    <span class="star">事项说明</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-input v-model="record.remark" />
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="接收人"
                  :width="200"
                  dataIndex="acceptId"
                >
                  <template #title>
                    <span class="star">接收人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.acceptId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
                <a-table-column
                  title="监督人"
                  :width="200"
                  dataIndex="superviseId"
                >
                  <template #title>
                    <span class="star">监督人</span>
                  </template>
                  <template #cell="{ record }">
                    <a-form-item hide-label>
                      <a-select
                        placeholder="请选择"
                        v-model="record.superviseId"
                        allow-search
                        allow-clear
                        disabled
                      >
                      </a-select>
                    </a-form-item>
                  </template>
                </a-table-column>
              </template>
            </a-table>
          </a-form-item>
        </section>
      </a-form>
    </div>
  </a-modal>
</template>
<script setup lang="ts">
const props = defineProps<{
  visible: boolean;
  data: any;
}>();

const emits = defineEmits(['update:visible', 'contractAttachmentTemplateEmit']);

const rulesData = [{}, {}];
const formData = reactive({
  data: {}
});

watch(
  () => props.visible,
  (newVal: boolean) => {
    if (newVal) {
      formData.data = props.data;
      console.log('====================================');
      console.log(formData.data);
      console.log('====================================');
    }
  }
);

const handleOk = () => {
  emits('update:visible', false);
};

const handleCancel = () => {
  emits('update:visible', false);
};
</script>
<style scoped lang="less">
.wrap {
  width: 90%;
  margin: 20px auto;

  section {
    margin-bottom: 20px;
    .title-box {
      position: relative;
      .title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        height: 36px;
        border-radius: 4px;
        font-weight: 700;
        // margin-bottom: 10px;
        background: #edeffd;
      }

      &::before {
        position: absolute;
        // top: 33px;
        left: 10px;
        display: inline-block;
        height: 18px;
        top: 50%;
        transform: translateY(-50%);
        width: 5px;
        margin-right: 20px;
        border-radius: 2px;
        // transform: translateY(-50%);
        content: '';
        background-color: #165dff;
      }
      .icon {
        cursor: pointer;
        margin-right: 20px;
      }
    }
    .operation {
      position: relative;
      bottom: 10px;
    }

    .star::before {
      content: '*';
      color: red;
    }
  }

  footer {
    height: 50px;
    width: calc(100% - 100px);
    background-color: #fff;
    box-shadow: 1px -1px 10px 0 #cacaca;
    position: fixed;
    bottom: 0;
    left: 10%;
    display: flex;
    justify-content: center;
    align-items: center;

    .btn {
      width: 120px;
      height: 40px;
      border-radius: 5px;
    }
  }
}
:deep(.arco-input-wrapper) {
  border-style: none;
}

:deep(.arco-upload-wrapper) {
  text-align: center;
}
:deep(.arco-table-th),
:deep(.arco-table-td) {
  height: 30px;
}

:deep(.arco-table-th) {
  font-weight: 700;
}

:deep(.arco-table-cell) {
  justify-content: center;
  text-align: center;
}
</style>
